<?php require_once(dirname(__FILE__).'/inc/config.inc.php');IsModelPriv('adtype_list'); ?>
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
<meta name="viewport" content="width=device-width,minimum-scale=1.0,maximum-scale=1.0,initial-scale=1.0,user-scalable=no" />
<meta name="apple-mobile-web-app-capable" content="yes" />
<title>广告位管理 </title>
<link href="templates/css/style.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" charset="utf-8" src="templates/js/jquery-1.11.2.min.js"></script>
<script type="text/javascript" charset="utf-8" src="templates/js/laymain.js"></script>
<script type="text/javascript" charset="utf-8" src="templates/js/common.js"></script>
<script type="text/javascript" src="templates/js/forms.func.js"></script>
</head>

<body class="mainbody">
<!--导航栏-->
<div class="location">
  <a href="javascript:history.back(-1);" class="back"><i></i><span>返回上一页</span></a>
  <a href="home.php" class="home"><i></i><span>首页</span></a>
  <i class="arrow"></i>
  <span>广告位管理</span>
  <a href="javascript:location.reload();" class="reload">刷新</a>
</div>
<!--/导航栏-->

<!--工具栏-->
<div id="floatHead" class="toolbar-wrap">
  <div class="toolbar">
    <div class="box-wrap">
      <a class="menu-btn"></a>
      <div class="l-list">
        <ul class="icon-list">
			 <?php if(IsModel('admin','add',1)!=false) echo'<li><a href="adtype_add.php" class="add"><i></i><span>新增广告位</span></a></li>';?>
				<li><a class="all" href="javascript:;" onclick="checkAll(this);"><i></i><span>全选</span></a></li>
				<?php if(IsModel('admin','add',1)!=false) echo'<li><a href="javascript:DelAll(\'navigation_save.php\');" onclick="return ConfDelAll(1);" class="del"><i></i><span>删除</span></a></li>';?>
        </ul>
      </div>
    
    </div>
  </div>
</div>
<!--/工具栏-->
<form method="post" action="" id="form1">
<!--列表-->
<div class="table-container">
  
 	<table width="100%" border="0" cellpadding="0" cellspacing="0" class="ltable">
	  <tr >
      <th width="5%">选择</th>
      <th width="5%">ID</th>
      <th width="32%" align="left">广告位名称</th>
      <th width="15%" align="left">尺寸px</th>
      <th width="15%" align="center">排序</th>
      <th width="30%">操作</th>
	
    </tr>
	<?php
	function Show($id=0, $i=0)
	{
		global $dosql,$cfg_siteid;
		$dosql->Execute("SELECT * FROM `#@__adtype` WHERE siteid='$cfg_siteid' AND `parentid`=$id ORDER BY `orderid` ASC",$id);
		$i++;
	
		while($row = $dosql->GetArray($id))
		{
			switch($row['checkinfo'])
			{
				case 'true':
					$checkinfo = '隐藏';
					break;  
				case 'false':
					$checkinfo = '显示';
					break;
				default:
					$checkinfo = '没有获取到参数';
			}
	
			//设置$classname
			$classname = '';
			
		//设置折叠
			if($row['parentid'] == '0')
				$classname .= '<span class="minusSign" id="rowid_'.$row['id'].'" onclick="DisplayRows('.$row['id'].');">';
			else
				$classname .= '<span class="subType">';

			//设置空格
			for($n = 1; $n < $i; $n++)
				$classname .= '&nbsp;&nbsp;';
		
			$classname .= $row['classname'];


	?>
	
		<tr id="rowpid_<?php echo GetTopID($row['parentstr']); ?>">

				<td align="center"><span class="checkall" style="vertical-align:middle;"><input type="checkbox" name="checkid[]" value="<?php echo $row['id']; ?>" /></span></td>
				<td align="center"><?php echo $row['id']; ?><input type="hidden"  name="id[]"id="id[]" value="<?php echo $row['id']; ?>" /></td>	
				
				<td ><?php echo $classname; ?></td>
				<td width="15%"><?php echo $row['width'].'*'.$row['height']; ?></td>
				<td width="15%" align="center"><a href="adtype_save.php?action=up&id=<?php echo $row['id']; ?>&parentid=<?php echo $row['parentid']; ?>&orderid=<?php echo $row['orderid']; ?>" class="leftArrow" title="提升排序"></a>
					<input name="orderid[]" type="text" id="orderid[]" class="sort" value="<?php echo $row['orderid']; ?>" />
					<a href="adtype_save.php?action=down&id=<?php echo $row['id']; ?>&parentid=<?php echo $row['parentid']; ?>&orderid=<?php echo $row['orderid']; ?>" class="rightArrow" title="下降排序"></a></td>
				
				<td align="center" style="white-space:nowrap;word-break:break-all;overflow:hidden;"><span><a href="adtype_add.php">添加广告位</a></span> | <span><a href="adtype_update.php?id=<?php echo $row['id']; ?>">修改</a></span> | <span class="nb"><a href="adtype_save.php?action=del&id=<?php echo $row['id'] ?>" onclick="return ConfDel(2);">删除</a></span></td>
			</tr>
	
	<?php
			Show($row['id'], $i+2);
		}
	}

	Show();


	//判断无记录样式
	if($dosql->GetTotalRow(0) == 0)
	{
		echo '<tr><td align="center" colspan="9">暂无记录</td></tr>';
	}
	
	

	?>
  	</table>
  
</div>
<!--/列表-->

<!--内容底部-->
<div class="line20"></div>
<div class="pagelist">
 <div class="l-btns">
    <span>选择：</span><span><a href="javascript:UpOrderID('adtype_save.php');">排序</a></span>  - <span><a href="javascript:ShowAllRows();">展开</a></span>  - <span><a href="javascript:HideAllRows();">隐藏</a></span> 

  </div>

</div>
<!--/内容底部-->
</form>
</body>
</html>
